package com.xiuyou.tracksdk.tracksdk.manager;


import android.content.Context;

import com.xiuyou.tracksdk.http.ResponseParams;
import com.xiuyou.tracksdk.tracksdk.module.BaseResult;
import com.xiuyou.tracksdk.tracksdk.module.HistoryPoint;
import com.xiuyou.tracksdk.tracksdk.module.ILocation;
import com.xiuyou.tracksdk.tracksdk.module.TrackRequest;
import com.xiuyou.tracksdk.tracksdk.protocol.CallBack;
import com.xiuyou.tracksdk.tracksdk.protocol.imp.ITrackProtocol;
import java.util.List;

/**
 * Created by lhy on 2016/6/13.
 */
public class TrackManger {
    private static TrackManger INSTANCE = null;
    private ITrackProtocol iTrackProtocol = null;
    private TrackManger(){
        iTrackProtocol = new ITrackProtocol();
    }
    public  static TrackManger getInstance(){
        if(INSTANCE == null){
            synchronized (TrackManger.class){
                if(INSTANCE == null){
                    INSTANCE = new TrackManger();
                }
            }
        }
        return INSTANCE;
    }

    /**
     * 一个track添加最新轨迹点。
     * @param iLocation
     * @param callBack
     * @param <T>
     */
    public <T extends BaseResult> void addPoint(Context mcontext, ILocation iLocation, CallBack<T> callBack){
        iTrackProtocol.addpoint(mcontext,iLocation,callBack);
    }

    /**
     * 批量添加最新轨迹点
     * @param mcontext
     * @param iLocationList
     * @param callBack
     * @param <T>
     */
    public <T extends BaseResult> void addPoints(Context mcontext, List<ILocation> iLocationList, CallBack callBack) {
        iTrackProtocol.addPoints(mcontext,iLocationList,callBack);
    }

    /**
     * 查询历史轨迹
     * @param mcontext
     * @param trackRequest
     * @param callBack
     * @param <T>
     */
    public <T extends HistoryPoint> void gethistory(Context mcontext, TrackRequest trackRequest, CallBack<T> callBack){
        iTrackProtocol.gethistory(mcontext,trackRequest,callBack);
    };


}
